package pt.ist.meic.pava;

import javassist.CtMethod;

/**
 * 
 * @author Antonio Massingue
 * @author Joao Matos
 * @author Nuno Santos
 * 
 * This Exception should be thrown when a static method 
 * is defined within a Trait implementation
 * 
 */
public class BadTraitMethodDefinitionException extends Exception {

	/**
	 * Serial Version Id
	 */
	private static final long serialVersionUID = 1232733434426739046L;

	/**
	 * The method defined
	 */
	private CtMethod ctMethod;
	
	
	
	
	
	/**
	 * Default Constructor
	 */
	public BadTraitMethodDefinitionException() {
		super();
	}

	
	
	
	
	
	
	/**
	 * Overloaded Constructor
	 * @param aMethod - the static method
	 */
	public BadTraitMethodDefinitionException(CtMethod aMethod){
		super();
		this.ctMethod = aMethod;
	}
	
	
	
	/**
	 * This method prints the detailed message of the thrown exception
	 */
	public void printBadTraitMethodException() {
		System.err.println("The "+this.ctMethod.getName()+" of the class "+this.ctMethod.getDeclaringClass().getName()+" is defined as static");
	}

	
	
	/**
	 * @return the method 
	 */
	public CtMethod getCtMethod() {
		return ctMethod;
	}

	
	
	/**
	 * @param ctMethod the method
	 */
	public void setCtMethod(CtMethod ctMethod) {
		this.ctMethod = ctMethod;
	}

	 
}
